package com.gmadmin.controller;

import com.gmadmin.common.ApiResponse;
import com.gmadmin.entity.vo.MessageNoticeVo;
import com.gmadmin.service.MessageNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhangliang
 * @version 1.0
 * @date 2022/8/2 20:16
 */

@Api(tags = "通知:消息管理")
@RequestMapping("api/notify/message")
@RestController
public class MessageController {

    private final MessageNoticeService noticeService;

    public MessageController(MessageNoticeService noticeService) {
        this.noticeService = noticeService;
    }

    @ApiOperation("根据type分组查询通知消息ids")
    @GetMapping("list/group/type")
    public ApiResponse<List<MessageNoticeVo>> findListByReceiveIdAndGroupByType(Long receiveId, Long type, Long state) {
        List<MessageNoticeVo> messageNoticeVos = noticeService.findListByReceiveIdAndType(receiveId, type, state);
        return ApiResponse.ofSuccess(messageNoticeVos);
    }

}
